Throw an error when a display is missing
authorMatthias Clasen <mclasen@redhat.com>
Sat, 30 Jan 2016 21:06:59 +0000 (16:06 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 30 Jan 2016 21:06:59 +0000 (16:06 -0500)
Creating style context won't work without a display, so
give a clear error message and abort instead of segfaulting
later on.

https://bugzilla.gnome.org/show_bug.cgi?id=761332

gtk/gtkstylecontext.c

index ae47e8b315df43a82f7489644e32edbd3f9eb09c..7d5664af8044c63411263b7187e4d863aa0fc156 100644 (file)
@@ -330,6 +330,9 @@ gtk_style_context_init (GtkStyleContext *context)
 
   priv->screen = gdk_screen_get_default ();
 
+  if (priv->screen == NULL)
+    g_error ("Can't create a GtkStyleContext without a display connection");
+
   priv->property_cache = g_array_new (FALSE, FALSE, sizeof (PropertyValue));
 
   gtk_style_context_set_cascade (context,